{% extends 'index.html' %}
{% load comments %}
{% block page-content %}
<!--bbs-contents-->

{% block index__part %}
        <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/css/more.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="/static/css/navbar-fixed-top.css" rel="stylesheet">

    <link href="/static/css/ico.css" rel="stylesheet">
    <!--从虎嗅网中导入的带阴影的边框，代码保存在/static/css/customize.css中-->
    <link href="/static/css/customize.css" rel="stylesheet">
    <style>
a.ex1:hover,a.ex1:active {color:red;}
a.ex2:hover,a.ex2:active {font-size:150%;}
a.ex3:hover,a.ex3:active {background:red;}
a.ex4:hover,a.ex4:active {font-family:'微软雅黑';}
a.ex5:visited,a.ex5:link {text-decoration:none;}
a.ex5:hover,a.ex5:active {text-decoration:underline;}
</style>
    <center>
    <div  style="width: 800px;margin-left:auto;margin-right: auto;">
    <div style="line-height: 2.5em;">
     <h3> {{ bbs_obj.title }} </h3>
    <br>
    <p>
    {{ bbs_obj.content | safe}}
    </p>
</div>

<hr>
<div class="comments">
    <div align="left">
        {% get_comment_count for bbs_obj as comment_count %}
        当前有{{ comment_count }}个评论

    </div>
    <br>
<div align="left">
    {% if user.is_authenticated %}
        <form action="/sub_comment/" method="POST">
        {% csrf_token %}
            <textarea class="form-control" cols="80" rows="2" name='comment_content' ></textarea><br>
            <input type="hidden" name="bbs_id" value="{{ bbs_obj.id }}" />
            <input type="submit" value="回复" id="id_submit" />
        </form>
    {% else %}
        <p>请 <a href="/login/">Login</a> 后再进行评论</p>
    {% endif %}
</div>
    <hr>
    {% get_comment_list for bbs_obj as comment_list %}
      {% for comment in comment_list reversed %}
       <a  class="ex3" href="#"> <div align="left" style="padding: 5px;"> {{ comment.submit_date }} by {{ comment.user }}:
          <br>
           {{ comment.comment | safe }}</div></a><br>

      {% endfor %}
</div>
    </div>
    </center>

{% endblock %}
{% endblock %}
